IF EXISTS ( SELECT  *
            FROM    dbo.sysobjects
            WHERE   id = OBJECT_ID(N'[CGO_GameGetPackageList]')
                    AND OBJECTPROPERTY(id, N'IsProcedure') = 1 ) 
  DROP PROCEDURE CGO_GameGetPackageList
GO

SET QUOTED_IDENTIFIER ON
SET ANSI_NULLS ON
GO


CREATE PROCEDURE dbo.[CGO_GameGetPackageList] 
  --@PortalID INT
AS 
  --IF @PortalID IS NULL
  --  OR @PortalID < 0 
  --  BEGIN
  --    SET @PortalID = 0
  --  END
    
  SELECT  dbo.CGO_Game.GameID ,
          dbo.CGO_Game.Name AS GameName ,
          Packages.*
  FROM    dbo.Packages
          INNER JOIN dbo.CGO_Game ON dbo.Packages.Name = dbo.CGO_Game.PackageName
  --WHERE   ( @PortalID = 0
  --          OR Packages.PortalID = @PortalID
  --        )
  ORDER BY Packages.FriendlyName ASC
GO
